var guonei=document.querySelector('.guonei')
console.log(guonei)
let xhr1=new XMLHttpRequest()
xhr1.open('get',`http://chst.vip:1234/api/getinlanddiscount`,true,)
xhr1.onload=function(){

    if(xhr1.status===200){
        var res2=JSON.parse(xhr1.responseText)
         console.log(res2.result)
    let regExp = /^<[^<]+\s+src="([^''""]*)"/;

         var lis2=''

         res2.result.forEach(function(so,ind){
         let tu = res2.result[ind].productImg.match(regExp)[1];
    //    console.log(tu)
        lis2+=`
     <li class="chanpin" productid="${so.productId}">
        <img src="${tu}">
        <h5>${so.productName}</h5>
        <span>${so.productPrice}</span>
        
         <span>${so.productFrom}</span>
          <span class="sp">${so. productTime}</span>
        </li>         
       
       `
    })
   guonei.innerHTML=lis2


   $('.guonei li').click(function(ev){
    var e=ev||window.event
    var target=e.target||e.srcElement
       
    if(target.nodeName==="LI"){
    
        localStorage.setItem("productid",target.getAttribute('productid'))

    }
    else{
        localStorage.setItem("productid",target.parentNode.getAttribute('productid'))
        
    }
    location.href="./国内折扣详情页.html"
})






   


 
    }
   
}
   
xhr1.send(null)

$('.icon-zuojiantou1').click(function(){
    location.href="./商品首页.html"
})
$('.bot span:nth-of-type(3)').click(function(){

    document.documentElement.scrollTop = 0

})

